/**
 * Copyright (c) 2021 shanghaozhi
   StatusViewJS is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2.
   You may obtain a copy of Mulan PSL v2 at:
            http://license.coscl.org.cn/MulanPSL2
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
   See the Mulan PSL v2 for more details.
 */
import toastUtil from "../../common/Util.js"

export default {
    data: {
        datas: ['测试数据1', '测试数据2', '测试数据3', '测试数据4', '测试数据5'],
        isShowList: false,
    },
    computed: {
        showList() {
            return this.isShowList
        },
    },
    onInit() {
        console.error('AAA - index1')
    },
//自定义事件、测试按钮事件
    clickMethod() {
        var that = this;
        if (this.isShowList) {
            this.isShowList = false
        }
        try {
            var statusLayout = that.$child("contentView")
            statusLayout.showLoading()
            setTimeout(function () {
                var num = Math.floor(Math.random() * 10 + 1); //1-10
                if (num <= 3) {
                    statusLayout.stopAnim()
                    that.isShowList = true;
                } else if (num <= 7) {
                    console.error("AAA - showerror")
                    statusLayout.showError()
                } else {
                    console.error("AAA - showempty")
                    statusLayout.showEmpty()
                }
            }, 1000)
        } catch (e) {
            console.error("AAA - e  " + e)
        }
    },
}
